import {questionType,difficulty} from '../api/hmmm/constants'
import { parseTime } from './index'
export function dataFormate (data) {
    //1.题型
   data.forEach(element => {
    questionType.forEach(el=>{
        if( element.questionType==el.value){
            element.questionType=el.label
        }
    })
 });
 //格式化时间
 data.forEach(element=>{
     element.addDate=parseTime(element.addDate)
 })
 //格式化难度
data.forEach(element => {
    difficulty.forEach(el=>{
        if( element.difficulty==el.value){
            element.difficulty=el.label
        }
    })
});
//格式化审核状态
    data.forEach(element => {
        if (element.chkState>=0) {
            if (element.chkState == 0) {
                element.chkState='待审核'
            } else if (element.chkState == 1) {
                element.chkState='通过'
            } else {
                element.chkState= '拒绝'
            }
        }
    })
//发布状态格式化
data.forEach(element => {
    if (element.publishState>=0) {
        if (element.publishState == 0) {
            element.publishState='待发布'
        }  else {
            element.publishState= '发布'
        }
    }
})
  }